
<template>
  <div>
    <SearchForm :search-list="searchList" :search-params="searchParams"></SearchForm>
    <div class="table-layout">
      <el-card shadow="never">
        <div class="table-box">
          <el-table
              border
              v-loading="loading"
              max-height="420px"
              :data="tableData"
              element-loading-spinner="el-icon-loading"
              element-loading-background="rgba(255, 255, 255, 0.8)"
              @selection-change="onSelect"
          >
            <el-table-column v-for="item in columns" :key="item.prop" :prop="item.prop" :label="item.label">
              <template slot-scope="scope">
            <span v-if="item.type === 'select'">
              {{ item.mapping[scope.row[item.prop]] }}
            </span>
                <span v-else>{{ scope.row[item.prop] }}</span>
              </template>
            </el-table-column>
            <el-table-column label="操作" fixed="right">
              <el-popconfirm
                  title="确认删除该条数据吗？"
              >
                <el-button type="text" style="color: red" slot="reference" @click="onEdit(scope.row)">删除</el-button>
              </el-popconfirm>
            </el-table-column>
          </el-table>
        </div>
        <div class="page-box">
          <el-pagination
              background
              :current-page="pageNo"
              :page-sizes="pageSizes"
              :page-size="pageSize"
              layout="total, sizes, prev, pager, next, jumper"
              :total="totalSize"
              @size-change="changePageSize"
              @current-change="changePageNo"
          />
        </div>
      </el-card>
    </div>
  </div>
</template>
<script>

import crud from "@/mixins/crud";

export default {
  name: "index",
  mixins: [crud],
  data() {
    return {
      searchList: [
        {
          label: '登录时间',
          prop: 'loginTime',
          name: 'date',
          dateType: 'datetimerange',
        }
      ],
      searchParams: {},
      columns: [
        // 登录IP、IP归属地、登录时间
        { label: '登录IP', prop: 'ip',  },
        { label: 'IP归属地', prop: 'ipLocation' },
        { label: '登录时间', prop: 'loginTime' },
      ]
    }
  }
}
</script>

<style scoped lang="scss">

</style>
